﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml;
using YArchitech.BIM;
using YArchitech.Controls;
using YArchitech.LIB;

namespace YArchitech.HYSpace
{
	public class LoadParamOperate
	{
		public LoadParamOperate()
		{
			this.loadPath = Product.UserDataLocation + "\\HYSpaceInfo.xml";
			string sourceFileName = Product.InstallLocation + "\\Data\\HYSpaceInfo.xml";
			this.xmlDoc = new XmlDocument();
			if (!File.Exists(this.loadPath))
			{
				File.Copy(sourceFileName, this.loadPath);
			}
			if (File.Exists(this.loadPath))
			{
				this.xmlDoc.Load(this.loadPath);
			}
		}

		public IList<SpaceParameterInfo> GetAllSpaceInfo()
		{
			IList<SpaceParameterInfo> list = new List<SpaceParameterInfo>();
			if (this.xmlDoc == null)
			{
				YJKMessageBox.Show("空间信息表丢失，\n无法正常加载!");
				return null;
			}
			try
			{
				foreach (XmlElement xmlElement in this.GetElementsByNode("SpaceUse"))
				{
					list.Add(new SpaceParameterInfo
					{
						RoomId = (string.IsNullOrEmpty(xmlElement.GetAttribute("Id")) ? 0 : Convert.ToInt32(xmlElement.GetAttribute("Id"))),
						RoomTypeId = (string.IsNullOrEmpty(xmlElement.GetAttribute("TypeId")) ? 0 : Convert.ToInt32(xmlElement.GetAttribute("TypeId"))),
						RoomName = (string.IsNullOrEmpty(xmlElement.GetAttribute("Name")) ? "" : xmlElement.GetAttribute("Name")),
						Operation = "无操作"
					});
				}
				List<XmlElement> elementsByNode = this.GetElementsByNode("SpaceType");
				List<XmlElement> elementsByNode2 = this.GetElementsByNode("SpaceLoad");
				string group = "1.设计参数";
				string group2 = "2.冷热指标";
				string group3 = "3.其他参数";
				foreach (SpaceParameterInfo spaceParameterInfo in list)
				{
					XmlElement elementByValue = this.GetElementByValue(elementsByNode, "Id", spaceParameterInfo.RoomTypeId.ToString());
					spaceParameterInfo.RoomTypeName = (string.IsNullOrEmpty(elementByValue.GetAttribute("Name")) ? "" : elementByValue.GetAttribute("Name"));
					XmlElement elementByValue2 = this.GetElementByValue(elementsByNode2, "RoomId", spaceParameterInfo.RoomId.ToString());
					spaceParameterInfo.Param = new List<SpacePara>();
					SpacePara spacePara = new SpacePara();
					spacePara.Group = group3;
					spacePara.Key = "盈建科-电动设备功率(W/m^2)";
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("DianDongGL")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("DianDongGL")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Group = group3;
					spacePara.Key = "盈建科-电动设备时间表";
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("DianDongSJB")) ? "" : Convert.ToString(elementByValue2.GetAttribute("DianDongSJB")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Group = group3;
					spacePara.Key = "盈建科-电动设备同时使用系数";
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("DianDongTSSYXS")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("DianDongTSSYXS")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Group = group3;
					spacePara.Key = "盈建科-电热设备功率(W/m^2)";
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("DianReGL")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("DianReGL")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Group = group3;
					spacePara.Key = "盈建科-电热设备时间表";
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("DianReSJB")) ? "" : Convert.ToString(elementByValue2.GetAttribute("DianReSJB")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Group = group3;
					spacePara.Key = "盈建科-电热设备同时使用系数";
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("DianReTSSYXS")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("DianReTSSYXS")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Group = group3;
					spacePara.Key = "盈建科-电子设备功率(W/m^2)";
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("DianZiGL")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("DianZiGL")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Group = group3;
					spacePara.Key = "盈建科-电子设备时间表";
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("DianZiSJB")) ? "" : Convert.ToString(elementByValue2.GetAttribute("DianZiSJB")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Group = group3;
					spacePara.Key = "盈建科-电子设备同时使用系数";
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("DianZiTSSYXS")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("DianZiTSSYXS")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Group = group;
					spacePara.Key = "盈建科-冬季采暖设计相对湿度(%)";
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("DongJiCNSJXDSD")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("DongJiCNSJXDSD")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Group = group;
					spacePara.Key = "盈建科-冬季采暖设计温度(℃)";
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("DongJiCNSNSJWD")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("DongJiCNSNSJWD")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Group = group;
					spacePara.Key = "盈建科-冬季空调设计温度(℃)";
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("DongJiSNSJWD")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("DongJiSNSJWD")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Group = group;
					spacePara.Key = "盈建科-冬季空调设计相对湿度(%)";
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("DongJiSNSJXDSD")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("DongJiSNSJXDSD")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Key = "盈建科-劳动强度(enum)";
					spacePara.Group = group3;
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("LaoDongQD")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("LaoDongQD")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Key = "盈建科-其他冷指标(W/m^2)";
					spacePara.Group = group2;
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("QiTaLZB")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("QiTaLZB")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Key = "盈建科-其他热指标(W/m^2)";
					spacePara.Group = group2;
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("QiTaRZB")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("QiTaRZB")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Key = "盈建科-人员密度(人/m^2)";
					spacePara.Group = group3;
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("RenYuanMD")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("RenYuanMD")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Key = "盈建科-人员总数";
					spacePara.Group = group3;
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("RenYuanZS")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("RenYuanZS")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Key = "盈建科-人员冷指标(W/m^2)";
					spacePara.Group = group2;
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("RenYuanLZB")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("RenYuanLZB")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Key = "盈建科-人员热指标(W/m^2)";
					spacePara.Group = group2;
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("RenYuanRZB")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("RenYuanRZB")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Key = "盈建科-人员时间表";
					spacePara.Group = group3;
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("RenYuanSJB")) ? "" : Convert.ToString(elementByValue2.GetAttribute("RenYuanSJB")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Key = "盈建科-设备标准(W/m^2)";
					spacePara.Group = group3;
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("SheBeiBZ")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("SheBeiBZ")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Key = "盈建科-室内允许最大风速(m/s)";
					spacePara.Group = group3;
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("ShiNeiZDFS")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("ShiNeiZDFS")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Key = "盈建科-围护冷指标(W/m^2)";
					spacePara.Group = group2;
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("WeiHuLZB")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("WeiHuLZB")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Key = "盈建科-围护热指标(W/m^2)";
					spacePara.Group = group2;
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("WeiHuRZB")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("WeiHuRZB")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Key = "盈建科-夏季空调设计温度(℃)";
					spacePara.Group = group;
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("XiaJiSNSJWD")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("XiaJiSNSJWD")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Key = "盈建科-夏季空调设计相对湿度(%)";
					spacePara.Group = group;
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("XiaJiSNSJXDSD")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("XiaJiSNSJXDSD")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Key = "盈建科-新风量(m^3/(h.人))";
					spacePara.Group = group3;
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("XinFengL")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("XinFengL")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Key = "盈建科-新风冷指标(W/m^2)";
					spacePara.Group = group2;
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("XinFengLZB")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("XinFengLZB")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Key = "盈建科-新风热指标(W/m^2)";
					spacePara.Group = group2;
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("XinFengRZB")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("XinFengRZB")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Key = "盈建科-新风时间表";
					spacePara.Group = group3;
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("XinFengSJB")) ? "" : Convert.ToString(elementByValue2.GetAttribute("XinFengSJB")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Key = "盈建科-用水量标准(L/(人.d))";
					spacePara.Group = group3;
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("YongShuiBZ")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("YongShuiBZ")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Key = "盈建科-允许采暖设计温度波动(%)";
					spacePara.Group = group;
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("YunXuDJSJWDBD")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("YunXuDJSJWDBD")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Key = "盈建科-允许采暖设计相对湿度波动(%)";
					spacePara.Group = group;
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("YunXuDJSJXDSDBD")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("YunXuDJSJXDSDBD")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Key = "盈建科-允许空调设计温度波动(%)";
					spacePara.Group = group;
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("YunXuSJWDBD")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("YunXuSJWDBD")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Key = "盈建科-允许空调设计相对湿度波动(%)";
					spacePara.Group = group;
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("YunXuSJXDSDBD")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("YunXuSJXDSDBD")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Key = "盈建科-噪音(dB)";
					spacePara.Group = group3;
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("ZaoYin")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("ZaoYin")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Key = "盈建科-照度(Lux)";
					spacePara.Group = group3;
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("ZhaoDu")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("ZhaoDu")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Key = "盈建科-照明标准(W/m^2)";
					spacePara.Group = group3;
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("ZhaoMingBZ")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("ZhaoMingBZ")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Key = "盈建科-照明时间表";
					spacePara.Group = group3;
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("ZhaoMingSJB")) ? "" : Convert.ToString(elementByValue2.GetAttribute("ZhaoMingSJB")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Key = "盈建科-总冷指标(W/m^2)";
					spacePara.Group = group2;
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("ZongLengZB")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("ZongLengZB")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Key = "盈建科-总热指标(W/m^2)";
					spacePara.Group = group2;
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("ZongReZB")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("ZongReZB")));
					spaceParameterInfo.Param.Add(spacePara);
					spacePara = new SpacePara();
					spacePara.Key = "ID";
					spacePara.Group = group3;
					spacePara.Value = (string.IsNullOrEmpty(elementByValue2.GetAttribute("Id")) ? "0" : Convert.ToString(elementByValue2.GetAttribute("Id")));
					spaceParameterInfo.Param.Add(spacePara);
				}
			}
			catch (Exception ex)
			{
				throw ex;
			}
			return list;
		}

		public IList<TimeAssign> GetAllTimeInfo()
		{
			IList<TimeAssign> list = new List<TimeAssign>();
			try
			{
				foreach (XmlElement xmlElement in this.GetElementsByNode("SpaceTime"))
				{
					list.Add(new TimeAssign
					{
						Operation = "无操作",
						TsName = (string.IsNullOrEmpty(xmlElement.GetAttribute("Name")) ? "" : xmlElement.GetAttribute("Name")),
						TsParent = (string.IsNullOrEmpty(xmlElement.GetAttribute("Type")) ? "" : xmlElement.GetAttribute("Type")),
						Id = (string.IsNullOrEmpty(xmlElement.GetAttribute("Id")) ? 0 : Convert.ToInt32(xmlElement.GetAttribute("Id"))),
						Version = 1,
						T0 = (string.IsNullOrEmpty(xmlElement.GetAttribute("T0")) ? 0.0 : Convert.ToDouble(xmlElement.GetAttribute("T0"))),
						T1 = (string.IsNullOrEmpty(xmlElement.GetAttribute("T1")) ? 0.0 : Convert.ToDouble(xmlElement.GetAttribute("T1"))),
						T2 = (string.IsNullOrEmpty(xmlElement.GetAttribute("T2")) ? 0.0 : Convert.ToDouble(xmlElement.GetAttribute("T2"))),
						T3 = (string.IsNullOrEmpty(xmlElement.GetAttribute("T3")) ? 0.0 : Convert.ToDouble(xmlElement.GetAttribute("T3"))),
						T4 = (string.IsNullOrEmpty(xmlElement.GetAttribute("T4")) ? 0.0 : Convert.ToDouble(xmlElement.GetAttribute("T4"))),
						T5 = (string.IsNullOrEmpty(xmlElement.GetAttribute("T5")) ? 0.0 : Convert.ToDouble(xmlElement.GetAttribute("T5"))),
						T6 = (string.IsNullOrEmpty(xmlElement.GetAttribute("T6")) ? 0.0 : Convert.ToDouble(xmlElement.GetAttribute("T6"))),
						T7 = (string.IsNullOrEmpty(xmlElement.GetAttribute("T7")) ? 0.0 : Convert.ToDouble(xmlElement.GetAttribute("T7"))),
						T8 = (string.IsNullOrEmpty(xmlElement.GetAttribute("T8")) ? 0.0 : Convert.ToDouble(xmlElement.GetAttribute("T8"))),
						T9 = (string.IsNullOrEmpty(xmlElement.GetAttribute("T9")) ? 0.0 : Convert.ToDouble(xmlElement.GetAttribute("T9"))),
						T10 = (string.IsNullOrEmpty(xmlElement.GetAttribute("T10")) ? 0.0 : Convert.ToDouble(xmlElement.GetAttribute("T10"))),
						T11 = (string.IsNullOrEmpty(xmlElement.GetAttribute("T11")) ? 0.0 : Convert.ToDouble(xmlElement.GetAttribute("T11"))),
						T12 = (string.IsNullOrEmpty(xmlElement.GetAttribute("T12")) ? 0.0 : Convert.ToDouble(xmlElement.GetAttribute("T12"))),
						T13 = (string.IsNullOrEmpty(xmlElement.GetAttribute("T13")) ? 0.0 : Convert.ToDouble(xmlElement.GetAttribute("T13"))),
						T14 = (string.IsNullOrEmpty(xmlElement.GetAttribute("T14")) ? 0.0 : Convert.ToDouble(xmlElement.GetAttribute("T14"))),
						T15 = (string.IsNullOrEmpty(xmlElement.GetAttribute("T15")) ? 0.0 : Convert.ToDouble(xmlElement.GetAttribute("T15"))),
						T16 = (string.IsNullOrEmpty(xmlElement.GetAttribute("T16")) ? 0.0 : Convert.ToDouble(xmlElement.GetAttribute("T16"))),
						T17 = (string.IsNullOrEmpty(xmlElement.GetAttribute("T17")) ? 0.0 : Convert.ToDouble(xmlElement.GetAttribute("T17"))),
						T18 = (string.IsNullOrEmpty(xmlElement.GetAttribute("T18")) ? 0.0 : Convert.ToDouble(xmlElement.GetAttribute("T18"))),
						T19 = (string.IsNullOrEmpty(xmlElement.GetAttribute("T19")) ? 0.0 : Convert.ToDouble(xmlElement.GetAttribute("T19"))),
						T20 = (string.IsNullOrEmpty(xmlElement.GetAttribute("T20")) ? 0.0 : Convert.ToDouble(xmlElement.GetAttribute("T20"))),
						T21 = (string.IsNullOrEmpty(xmlElement.GetAttribute("T21")) ? 0.0 : Convert.ToDouble(xmlElement.GetAttribute("T21"))),
						T22 = (string.IsNullOrEmpty(xmlElement.GetAttribute("T22")) ? 0.0 : Convert.ToDouble(xmlElement.GetAttribute("T22"))),
						T23 = (string.IsNullOrEmpty(xmlElement.GetAttribute("T23")) ? 0.0 : Convert.ToDouble(xmlElement.GetAttribute("T23")))
					});
				}
			}
			catch (Exception ex)
			{
				throw ex;
			}
			return list;
		}

		public IList<RoomType> GetAllRoomType()
		{
			IList<RoomType> list = new List<RoomType>();
			foreach (XmlElement xmlElement in this.GetElementsByNode("SpaceType"))
			{
				list.Add(new RoomType
				{
					RoomTypeId = Convert.ToInt32(xmlElement.GetAttribute("Id")),
					RoomTypeName = Convert.ToString(xmlElement.GetAttribute("Name"))
				});
			}
			return list;
		}

		public IList<RoomUse> GetAllRoomUse()
		{
			IList<RoomUse> list = new List<RoomUse>();
			List<XmlElement> elementsByNode = this.GetElementsByNode("SpaceUse");
			List<XmlElement> elementsByNode2 = this.GetElementsByNode("SpaceType");
			foreach (XmlElement xmlElement in elementsByNode)
			{
				RoomUse roomUse = new RoomUse();
				roomUse.RoomUseId = (string.IsNullOrEmpty(xmlElement.GetAttribute("Id")) ? 0 : Convert.ToInt32(xmlElement.GetAttribute("Id")));
				roomUse.RoomTypeId = (string.IsNullOrEmpty(xmlElement.GetAttribute("TypeId")) ? 0 : Convert.ToInt32(xmlElement.GetAttribute("TypeId")));
				roomUse.RoomName = (string.IsNullOrEmpty(xmlElement.GetAttribute("Name")) ? "" : xmlElement.GetAttribute("Name"));
				XmlElement elementByValue = this.GetElementByValue(elementsByNode2, "Id", roomUse.RoomTypeId.ToString());
				roomUse.RoomTypeName = (string.IsNullOrEmpty(elementByValue.GetAttribute("Name")) ? "" : elementByValue.GetAttribute("Name"));
				list.Add(roomUse);
			}
			return list;
		}

		public int GetMaxUseID()
		{
			List<XmlElement> elementsByNode = this.GetElementsByNode("SpaceUse");
			List<int> list = new List<int>();
			foreach (XmlElement xmlElement in elementsByNode)
			{
				if (!string.IsNullOrEmpty(xmlElement.GetAttribute("Id")))
				{
					list.Add(Convert.ToInt32(xmlElement.GetAttribute("Id")));
				}
			}
			return list.Max();
		}

		public int GetMaxLoadID()
		{
			List<XmlElement> elementsByNode = this.GetElementsByNode("SpaceLoad");
			List<int> list = new List<int>();
			foreach (XmlElement xmlElement in elementsByNode)
			{
				if (!string.IsNullOrEmpty(xmlElement.GetAttribute("Id")))
				{
					list.Add(Convert.ToInt32(xmlElement.GetAttribute("Id")));
				}
			}
			return list.Max();
		}

		public int GetMaxTimeID()
		{
			List<XmlElement> elementsByNode = this.GetElementsByNode("SpaceTime");
			List<int> list = new List<int>();
			foreach (XmlElement xmlElement in elementsByNode)
			{
				if (!string.IsNullOrEmpty(xmlElement.GetAttribute("Id")))
				{
					list.Add(Convert.ToInt32(xmlElement.GetAttribute("Id")));
				}
			}
			return list.Max();
		}

		public bool IsEffectiveTimeAssignName(string tsParent, string tsName, IList<TimeAssign> listTAssign)
		{
			bool result = false;
			foreach (TimeAssign timeAssign in listTAssign)
			{
				if (timeAssign.TsParent.Equals(tsParent) && timeAssign.TsName.Equals(tsName))
				{
					result = true;
					break;
				}
			}
			return result;
		}

		public bool UpdateSpaceParameterInfo(SpaceParameterInfo spi)
		{
			bool result;
			try
			{
				XmlNode nodeByName = this.GetNodeByName("SpaceUse");
				XmlElement xmlElement = null;
				foreach (object obj in nodeByName.ChildNodes)
				{
					XmlElement xmlElement2 = ((XmlNode)obj) as XmlElement;
					if (xmlElement2 != null && xmlElement2.GetAttribute("Id") == spi.RoomId.ToString())
					{
						xmlElement = xmlElement2;
						break;
					}
				}
				xmlElement.SetAttribute("TypeId", spi.RoomTypeId.ToString());
				xmlElement.SetAttribute("Name", spi.RoomName);
				foreach (object obj2 in this.GetNodeByName("SpaceLoad").ChildNodes)
				{
					XmlElement xmlElement3 = ((XmlNode)obj2) as XmlElement;
					if (xmlElement3 != null && xmlElement3.GetAttribute("RoomId") == spi.RoomId.ToString())
					{
						xmlElement = xmlElement3;
						break;
					}
				}
				SpaceLoadParameter spaceLoadParameter = this.TranformSpaceInfo(spi);
				xmlElement.SetAttribute("DianDongGL", spaceLoadParameter.DianDongGL.ToString());
				xmlElement.SetAttribute("DianDongSJB", spaceLoadParameter.DianDongSJB);
				xmlElement.SetAttribute("DianDongTSSYXS", spaceLoadParameter.DianDongTSSYXS.ToString());
				xmlElement.SetAttribute("DianReGL", spaceLoadParameter.DianReGL.ToString());
				xmlElement.SetAttribute("DianReSJB", spaceLoadParameter.DianReSJB);
				xmlElement.SetAttribute("DianReTSSYXS", spaceLoadParameter.DianReTSSYXS.ToString());
				xmlElement.SetAttribute("DianZiGL", spaceLoadParameter.DianZiGL.ToString());
				xmlElement.SetAttribute("DianZiSJB", spaceLoadParameter.DianZiSJB);
				xmlElement.SetAttribute("DianZiTSSYXS", spaceLoadParameter.DianZiTSSYXS.ToString());
				xmlElement.SetAttribute("DongJiCNSJXDSD", spaceLoadParameter.DongJiCNSJXDSD.ToString());
				xmlElement.SetAttribute("DongJiCNSNSJWD", spaceLoadParameter.DongJiCNSNSJWD.ToString());
				xmlElement.SetAttribute("DongJiSNSJWD", spaceLoadParameter.DongJiSNSJWD.ToString());
				xmlElement.SetAttribute("DongJiSNSJXDSD", spaceLoadParameter.DongJiSNSJXDSD.ToString());
				xmlElement.SetAttribute("LaoDongQD", spaceLoadParameter.LaoDongQD.ToString());
				xmlElement.SetAttribute("QiTaLZB", spaceLoadParameter.QiTaLZB.ToString());
				xmlElement.SetAttribute("QiTaRZB", spaceLoadParameter.QiTaRZB.ToString());
				xmlElement.SetAttribute("RenYuanMD", spaceLoadParameter.RenYuanMD.ToString());
				xmlElement.SetAttribute("RenYuanZS", spaceLoadParameter.RenYuanZS.ToString());
				xmlElement.SetAttribute("RenYuanLZB", spaceLoadParameter.RenYuanLZB.ToString());
				xmlElement.SetAttribute("RenYuanRZB", spaceLoadParameter.RenYuanRZB.ToString());
				xmlElement.SetAttribute("RenYuanSJB", spaceLoadParameter.RenYuanSJB);
				xmlElement.SetAttribute("SheBeiBZ", spaceLoadParameter.SheBeiBZ.ToString());
				xmlElement.SetAttribute("ShiNeiZDFS", spaceLoadParameter.ShiNeiZDFS.ToString());
				xmlElement.SetAttribute("WeiHuLZB", spaceLoadParameter.WeiHuLZB.ToString());
				xmlElement.SetAttribute("WeiHuRZB", spaceLoadParameter.WeiHuRZB.ToString());
				xmlElement.SetAttribute("XiaJiSNSJWD", spaceLoadParameter.XiaJiSNSJWD.ToString());
				xmlElement.SetAttribute("XiaJiSNSJXDSD", spaceLoadParameter.XiaJiSNSJXDSD.ToString());
				xmlElement.SetAttribute("XinFengL", spaceLoadParameter.XinFengL.ToString());
				xmlElement.SetAttribute("XinFengLZB", spaceLoadParameter.XinFengLZB.ToString());
				xmlElement.SetAttribute("XinFengRZB", spaceLoadParameter.XinFengRZB.ToString());
				xmlElement.SetAttribute("XinFengSJB", spaceLoadParameter.XinFengSJB);
				xmlElement.SetAttribute("YongShuiBZ", spaceLoadParameter.YongShuiBZ.ToString());
				xmlElement.SetAttribute("YunXuDJSJWDBD", spaceLoadParameter.YunXuDJSJWDBD.ToString());
				xmlElement.SetAttribute("YunXuDJSJXDSDBD", spaceLoadParameter.YunXuDJSJXDSDBD.ToString());
				xmlElement.SetAttribute("YunXuSJWDBD", spaceLoadParameter.YunXuSJWDBD.ToString());
				xmlElement.SetAttribute("YunXuSJXDSDBD", spaceLoadParameter.YunXuSJXDSDBD.ToString());
				xmlElement.SetAttribute("ZaoYin", spaceLoadParameter.ZaoYin.ToString());
				xmlElement.SetAttribute("ZhaoDu", spaceLoadParameter.ZhaoDu.ToString());
				xmlElement.SetAttribute("ZhaoMingBZ", spaceLoadParameter.ZhaoMingBZ.ToString());
				xmlElement.SetAttribute("ZhaoMingSJB", spaceLoadParameter.ZhaoMingSJB);
				xmlElement.SetAttribute("ZongLengZB", spaceLoadParameter.ZongLengZB.ToString());
				xmlElement.SetAttribute("ZongReZB", spaceLoadParameter.ZongReZB.ToString());
				xmlElement.SetAttribute("Id", spaceLoadParameter.Id.ToString());
				this.xmlDoc.Save(this.loadPath);
				result = true;
			}
			catch (Exception)
			{
				result = false;
			}
			return result;
		}

		public SpaceLoadParameter TranformSpaceInfo(SpaceParameterInfo spi)
		{
			return new SpaceLoadParameter
			{
				DianDongGL = Convert.ToDouble(this.GetParam(spi, "盈建科-电动设备功率(W/m^2)")),
				DianDongSJB = Convert.ToString(this.GetParam(spi, "盈建科-电动设备时间表")),
				DianDongTSSYXS = Convert.ToDouble(this.GetParam(spi, "盈建科-电动设备同时使用系数")),
				DianReGL = Convert.ToDouble(this.GetParam(spi, "盈建科-电热设备功率(W/m^2)")),
				DianReSJB = Convert.ToString(this.GetParam(spi, "盈建科-电热设备时间表")),
				DianReTSSYXS = Convert.ToDouble(this.GetParam(spi, "盈建科-电热设备同时使用系数")),
				DianZiGL = Convert.ToDouble(this.GetParam(spi, "盈建科-电子设备功率(W/m^2)")),
				DianZiSJB = Convert.ToString(this.GetParam(spi, "盈建科-电子设备时间表")),
				DianZiTSSYXS = Convert.ToDouble(this.GetParam(spi, "盈建科-电子设备同时使用系数")),
				DongJiCNSJXDSD = Convert.ToDouble(this.GetParam(spi, "盈建科-冬季采暖设计相对湿度(%)")),
				DongJiCNSNSJWD = Convert.ToDouble(this.GetParam(spi, "盈建科-冬季采暖设计温度(℃)")),
				DongJiSNSJWD = Convert.ToDouble(this.GetParam(spi, "盈建科-冬季空调设计温度(℃)")),
				DongJiSNSJXDSD = Convert.ToDouble(this.GetParam(spi, "盈建科-冬季空调设计相对湿度(%)")),
				LaoDongQD = Convert.ToInt32(this.GetParam(spi, "盈建科-劳动强度(enum)")),
				QiTaLZB = Convert.ToDouble(this.GetParam(spi, "盈建科-其他冷指标(W/m^2)")),
				QiTaRZB = Convert.ToDouble(this.GetParam(spi, "盈建科-其他热指标(W/m^2)")),
				RenYuanMD = Convert.ToDouble(this.GetParam(spi, "盈建科-人员密度(人/m^2)")),
				RenYuanZS = Convert.ToDouble(this.GetParam(spi, "盈建科-人员总数")),
				RenYuanLZB = Convert.ToDouble(this.GetParam(spi, "盈建科-人员冷指标(W/m^2)")),
				RenYuanRZB = Convert.ToDouble(this.GetParam(spi, "盈建科-人员热指标(W/m^2)")),
				RenYuanSJB = Convert.ToString(this.GetParam(spi, "盈建科-人员时间表")),
				SheBeiBZ = Convert.ToDouble(this.GetParam(spi, "盈建科-设备标准(W/m^2)")),
				ShiNeiZDFS = Convert.ToDouble(this.GetParam(spi, "盈建科-室内允许最大风速(m/s)")),
				WeiHuLZB = Convert.ToDouble(this.GetParam(spi, "盈建科-围护冷指标(W/m^2)")),
				WeiHuRZB = Convert.ToDouble(this.GetParam(spi, "盈建科-围护热指标(W/m^2)")),
				XiaJiSNSJWD = Convert.ToDouble(this.GetParam(spi, "盈建科-夏季空调设计温度(℃)")),
				XiaJiSNSJXDSD = Convert.ToDouble(this.GetParam(spi, "盈建科-夏季空调设计相对湿度(%)")),
				XinFengL = Convert.ToDouble(this.GetParam(spi, "盈建科-新风量(m^3/(h.人))")),
				XinFengLZB = Convert.ToDouble(this.GetParam(spi, "盈建科-新风冷指标(W/m^2)")),
				XinFengRZB = Convert.ToDouble(this.GetParam(spi, "盈建科-新风热指标(W/m^2)")),
				XinFengSJB = Convert.ToString(this.GetParam(spi, "盈建科-新风时间表")),
				YongShuiBZ = Convert.ToDouble(this.GetParam(spi, "盈建科-用水量标准(L/(人.d))")),
				YunXuDJSJWDBD = Convert.ToDouble(this.GetParam(spi, "盈建科-允许采暖设计温度波动(%)")),
				YunXuDJSJXDSDBD = Convert.ToDouble(this.GetParam(spi, "盈建科-允许采暖设计相对湿度波动(%)")),
				YunXuSJWDBD = Convert.ToDouble(this.GetParam(spi, "盈建科-允许空调设计温度波动(%)")),
				YunXuSJXDSDBD = Convert.ToDouble(this.GetParam(spi, "盈建科-允许空调设计相对湿度波动(%)")),
				ZaoYin = Convert.ToDouble(this.GetParam(spi, "盈建科-噪音(dB)")),
				ZhaoDu = Convert.ToDouble(this.GetParam(spi, "盈建科-照度(Lux)")),
				ZhaoMingBZ = Convert.ToDouble(this.GetParam(spi, "盈建科-照明标准(W/m^2)")),
				ZhaoMingSJB = Convert.ToString(this.GetParam(spi, "盈建科-照明时间表")),
				ZongLengZB = Convert.ToDouble(this.GetParam(spi, "盈建科-总冷指标(W/m^2)")),
				ZongReZB = Convert.ToDouble(this.GetParam(spi, "盈建科-总热指标(W/m^2)")),
				Id = Convert.ToInt32(this.GetParam(spi, "ID")),
				RoomUseId = spi.RoomId,
				RoomUseName = spi.RoomName
			};
		}

		private string GetParam(SpaceParameterInfo spi, string paraName)
		{
			string result = "";
			foreach (SpacePara spacePara in spi.Param)
			{
				if (spacePara.Key == paraName)
				{
					result = spacePara.Value;
				}
			}
			return result;
		}

		public bool DeleteSpaceParameterByRoomUse(int roomUseId)
		{
			bool result;
			try
			{
				XmlNode nodeByName = this.GetNodeByName("SpaceUse");
				XmlNode oldChild = null;
				foreach (object obj in nodeByName.ChildNodes)
				{
					XmlNode xmlNode = (XmlNode)obj;
					XmlElement xmlElement = xmlNode as XmlElement;
					if (xmlElement != null && xmlElement.GetAttribute("Id") == roomUseId.ToString())
					{
						oldChild = xmlNode;
						break;
					}
				}
				nodeByName.RemoveChild(oldChild);
				XmlNode nodeByName2 = this.GetNodeByName("SpaceLoad");
				foreach (object obj2 in nodeByName2.ChildNodes)
				{
					XmlNode xmlNode2 = (XmlNode)obj2;
					XmlElement xmlElement2 = xmlNode2 as XmlElement;
					if (xmlElement2 != null && xmlElement2.GetAttribute("RoomId") == roomUseId.ToString())
					{
						oldChild = xmlNode2;
						break;
					}
				}
				nodeByName2.RemoveChild(oldChild);
				this.xmlDoc.Save(this.loadPath);
				result = true;
			}
			catch (Exception)
			{
				result = false;
			}
			return result;
		}

		public bool DeleteTimeAssign(TimeAssign timeAssign)
		{
			bool result;
			try
			{
				XmlNode nodeByName = this.GetNodeByName("SpaceTime");
				XmlNode oldChild = null;
				foreach (object obj in nodeByName.ChildNodes)
				{
					XmlNode xmlNode = (XmlNode)obj;
					XmlElement xmlElement = xmlNode as XmlElement;
					if (xmlElement != null && xmlElement.GetAttribute("Id") == timeAssign.Id.ToString())
					{
						oldChild = xmlNode;
						break;
					}
				}
				nodeByName.RemoveChild(oldChild);
				this.xmlDoc.Save(this.loadPath);
				result = true;
			}
			catch (Exception)
			{
				result = false;
			}
			return result;
		}

		public bool UpdateTimeAssign(TimeAssign timeAssign)
		{
			bool result;
			try
			{
				XmlNode nodeByName = this.GetNodeByName("SpaceTime");
				XmlElement xmlElement = null;
				foreach (object obj in nodeByName.ChildNodes)
				{
					XmlElement xmlElement2 = obj as XmlElement;
					if (xmlElement2 != null && xmlElement2.GetAttribute("Id") == timeAssign.Id.ToString())
					{
						xmlElement = xmlElement2;
						break;
					}
				}
				xmlElement.SetAttribute("Name", timeAssign.TsName);
				xmlElement.SetAttribute("Type", timeAssign.TsParent);
				xmlElement.SetAttribute("T0", timeAssign.T0.ToString());
				xmlElement.SetAttribute("T1", timeAssign.T1.ToString());
				xmlElement.SetAttribute("T2", timeAssign.T2.ToString());
				xmlElement.SetAttribute("T3", timeAssign.T3.ToString());
				xmlElement.SetAttribute("T4", timeAssign.T4.ToString());
				xmlElement.SetAttribute("T5", timeAssign.T5.ToString());
				xmlElement.SetAttribute("T6", timeAssign.T6.ToString());
				xmlElement.SetAttribute("T7", timeAssign.T7.ToString());
				xmlElement.SetAttribute("T8", timeAssign.T8.ToString());
				xmlElement.SetAttribute("T9", timeAssign.T9.ToString());
				xmlElement.SetAttribute("T10", timeAssign.T10.ToString());
				xmlElement.SetAttribute("T11", timeAssign.T11.ToString());
				xmlElement.SetAttribute("T12", timeAssign.T12.ToString());
				xmlElement.SetAttribute("T13", timeAssign.T13.ToString());
				xmlElement.SetAttribute("T14", timeAssign.T14.ToString());
				xmlElement.SetAttribute("T15", timeAssign.T15.ToString());
				xmlElement.SetAttribute("T16", timeAssign.T16.ToString());
				xmlElement.SetAttribute("T17", timeAssign.T17.ToString());
				xmlElement.SetAttribute("T18", timeAssign.T18.ToString());
				xmlElement.SetAttribute("T19", timeAssign.T19.ToString());
				xmlElement.SetAttribute("T20", timeAssign.T20.ToString());
				xmlElement.SetAttribute("T21", timeAssign.T21.ToString());
				xmlElement.SetAttribute("T22", timeAssign.T22.ToString());
				xmlElement.SetAttribute("T23", timeAssign.T23.ToString());
				this.xmlDoc.Save(this.loadPath);
				result = true;
			}
			catch (Exception)
			{
				result = false;
			}
			return result;
		}

		public bool AddSpaceParameterInfo(SpaceParameterInfo spi, int loadId)
		{
			bool result;
			try
			{
				XmlNode nodeByName = this.GetNodeByName("SpaceUse");
				XmlElement xmlElement = this.xmlDoc.CreateElement("use");
				xmlElement.SetAttribute("Id", spi.RoomId.ToString());
				xmlElement.SetAttribute("Name", spi.RoomName);
				xmlElement.SetAttribute("TypeId", spi.RoomTypeId.ToString());
				nodeByName.AppendChild(xmlElement);
				XmlNode nodeByName2 = this.GetNodeByName("SpaceLoad");
				xmlElement = this.xmlDoc.CreateElement("load");
				SpaceLoadParameter spaceLoadParameter = this.TranformSpaceInfo(spi);
				xmlElement.SetAttribute("Id", loadId.ToString());
				xmlElement.SetAttribute("RoomId", spi.RoomId.ToString());
				xmlElement.SetAttribute("DianDongGL", spaceLoadParameter.DianDongGL.ToString());
				xmlElement.SetAttribute("DianDongSJB", spaceLoadParameter.DianDongSJB);
				xmlElement.SetAttribute("DianDongTSSYXS", spaceLoadParameter.DianDongTSSYXS.ToString());
				xmlElement.SetAttribute("DianReGL", spaceLoadParameter.DianReGL.ToString());
				xmlElement.SetAttribute("DianReSJB", spaceLoadParameter.DianReSJB);
				xmlElement.SetAttribute("DianReTSSYXS", spaceLoadParameter.DianReTSSYXS.ToString());
				xmlElement.SetAttribute("DianZiGL", spaceLoadParameter.DianZiGL.ToString());
				xmlElement.SetAttribute("DianZiSJB", spaceLoadParameter.DianZiSJB);
				xmlElement.SetAttribute("DianZiTSSYXS", spaceLoadParameter.DianZiTSSYXS.ToString());
				xmlElement.SetAttribute("DongJiCNSJXDSD", spaceLoadParameter.DongJiCNSJXDSD.ToString());
				xmlElement.SetAttribute("DongJiCNSNSJWD", spaceLoadParameter.DongJiCNSNSJWD.ToString());
				xmlElement.SetAttribute("DongJiSNSJWD", spaceLoadParameter.DongJiSNSJWD.ToString());
				xmlElement.SetAttribute("DongJiSNSJXDSD", spaceLoadParameter.DongJiSNSJXDSD.ToString());
				xmlElement.SetAttribute("LaoDongQD", spaceLoadParameter.LaoDongQD.ToString());
				xmlElement.SetAttribute("QiTaLZB", spaceLoadParameter.QiTaLZB.ToString());
				xmlElement.SetAttribute("QiTaRZB", spaceLoadParameter.QiTaRZB.ToString());
				xmlElement.SetAttribute("RenYuanMD", spaceLoadParameter.RenYuanMD.ToString());
				xmlElement.SetAttribute("RenYuanZS", spaceLoadParameter.RenYuanZS.ToString());
				xmlElement.SetAttribute("RenYuanLZB", spaceLoadParameter.RenYuanLZB.ToString());
				xmlElement.SetAttribute("RenYuanRZB", spaceLoadParameter.RenYuanRZB.ToString());
				xmlElement.SetAttribute("RenYuanSJB", spaceLoadParameter.RenYuanSJB);
				xmlElement.SetAttribute("SheBeiBZ", spaceLoadParameter.SheBeiBZ.ToString());
				xmlElement.SetAttribute("ShiNeiZDFS", spaceLoadParameter.ShiNeiZDFS.ToString());
				xmlElement.SetAttribute("WeiHuLZB", spaceLoadParameter.WeiHuLZB.ToString());
				xmlElement.SetAttribute("WeiHuRZB", spaceLoadParameter.WeiHuRZB.ToString());
				xmlElement.SetAttribute("XiaJiSNSJWD", spaceLoadParameter.XiaJiSNSJWD.ToString());
				xmlElement.SetAttribute("XiaJiSNSJXDSD", spaceLoadParameter.XiaJiSNSJXDSD.ToString());
				xmlElement.SetAttribute("XinFengL", spaceLoadParameter.XinFengL.ToString());
				xmlElement.SetAttribute("XinFengLZB", spaceLoadParameter.XinFengLZB.ToString());
				xmlElement.SetAttribute("XinFengRZB", spaceLoadParameter.XinFengRZB.ToString());
				xmlElement.SetAttribute("XinFengSJB", spaceLoadParameter.XinFengSJB);
				xmlElement.SetAttribute("YongShuiBZ", spaceLoadParameter.YongShuiBZ.ToString());
				xmlElement.SetAttribute("YunXuDJSJWDBD", spaceLoadParameter.YunXuDJSJWDBD.ToString());
				xmlElement.SetAttribute("YunXuDJSJXDSDBD", spaceLoadParameter.YunXuDJSJXDSDBD.ToString());
				xmlElement.SetAttribute("YunXuSJWDBD", spaceLoadParameter.YunXuSJWDBD.ToString());
				xmlElement.SetAttribute("YunXuSJXDSDBD", spaceLoadParameter.YunXuSJXDSDBD.ToString());
				xmlElement.SetAttribute("ZaoYin", spaceLoadParameter.ZaoYin.ToString());
				xmlElement.SetAttribute("ZhaoDu", spaceLoadParameter.ZhaoDu.ToString());
				xmlElement.SetAttribute("ZhaoMingBZ", spaceLoadParameter.ZhaoMingBZ.ToString());
				xmlElement.SetAttribute("ZhaoMingSJB", spaceLoadParameter.ZhaoMingSJB);
				xmlElement.SetAttribute("ZongLengZB", spaceLoadParameter.ZongLengZB.ToString());
				xmlElement.SetAttribute("ZongReZB", spaceLoadParameter.ZongReZB.ToString());
				nodeByName2.AppendChild(xmlElement);
				this.xmlDoc.Save(this.loadPath);
				result = true;
			}
			catch (Exception)
			{
				result = false;
			}
			return result;
		}

		public bool AddTimeAssign(TimeAssign timeAssign)
		{
			bool result;
			try
			{
				XmlNode nodeByName = this.GetNodeByName("SpaceTime");
				XmlElement xmlElement = this.xmlDoc.CreateElement("time");
				xmlElement.SetAttribute("Id", timeAssign.Id.ToString());
				xmlElement.SetAttribute("Name", timeAssign.TsName);
				xmlElement.SetAttribute("Type", timeAssign.TsParent);
				xmlElement.SetAttribute("T0", timeAssign.T0.ToString());
				xmlElement.SetAttribute("T1", timeAssign.T1.ToString());
				xmlElement.SetAttribute("T2", timeAssign.T2.ToString());
				xmlElement.SetAttribute("T3", timeAssign.T3.ToString());
				xmlElement.SetAttribute("T4", timeAssign.T4.ToString());
				xmlElement.SetAttribute("T5", timeAssign.T5.ToString());
				xmlElement.SetAttribute("T6", timeAssign.T6.ToString());
				xmlElement.SetAttribute("T7", timeAssign.T7.ToString());
				xmlElement.SetAttribute("T8", timeAssign.T8.ToString());
				xmlElement.SetAttribute("T9", timeAssign.T9.ToString());
				xmlElement.SetAttribute("T10", timeAssign.T10.ToString());
				xmlElement.SetAttribute("T11", timeAssign.T11.ToString());
				xmlElement.SetAttribute("T12", timeAssign.T12.ToString());
				xmlElement.SetAttribute("T13", timeAssign.T13.ToString());
				xmlElement.SetAttribute("T14", timeAssign.T14.ToString());
				xmlElement.SetAttribute("T15", timeAssign.T15.ToString());
				xmlElement.SetAttribute("T16", timeAssign.T16.ToString());
				xmlElement.SetAttribute("T17", timeAssign.T17.ToString());
				xmlElement.SetAttribute("T18", timeAssign.T18.ToString());
				xmlElement.SetAttribute("T19", timeAssign.T19.ToString());
				xmlElement.SetAttribute("T20", timeAssign.T20.ToString());
				xmlElement.SetAttribute("T21", timeAssign.T21.ToString());
				xmlElement.SetAttribute("T22", timeAssign.T22.ToString());
				xmlElement.SetAttribute("T23", timeAssign.T23.ToString());
				nodeByName.AppendChild(xmlElement);
				this.xmlDoc.Save(this.loadPath);
				result = true;
			}
			catch (Exception)
			{
				result = false;
			}
			return result;
		}

		private List<XmlElement> GetElementsByNode(string nodeName)
		{
			List<XmlElement> list = null;
			try
			{
				XmlNode xmlNode = this.xmlDoc.SelectSingleNode("SpaceInfo").SelectSingleNode(nodeName);
				list = new List<XmlElement>();
				foreach (object obj in xmlNode.ChildNodes)
				{
					list.Add(obj as XmlElement);
				}
			}
			catch (Exception ex)
			{
				throw ex;
			}
			return list;
		}

		private XmlNode GetNodeByName(string nodeName)
		{
			XmlNode result = null;
			try
			{
				result = this.xmlDoc.SelectSingleNode("SpaceInfo").SelectSingleNode(nodeName);
			}
			catch (Exception ex)
			{
				throw ex;
			}
			return result;
		}

		private XmlElement GetElementByValue(List<XmlElement> listElem, string attName, string attValue)
		{
			XmlElement result = null;
			try
			{
				foreach (XmlElement xmlElement in listElem)
				{
					if (xmlElement.GetAttribute(attName) == attValue)
					{
						result = xmlElement;
						break;
					}
				}
			}
			catch (Exception ex)
			{
				throw ex;
			}
			return result;
		}

		private string loadPath = "";

		private XmlDocument xmlDoc;
	}
}
